{extend name="base/main" /}
{block name="body"}
    <link rel="stylesheet" href="/static/layui/css/layui.css">
    <script src="/static/layui/layui.js"></script>
<body>
<form class="layui-form" action="{:url('set/pay_update')}" method="post">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">公众号支付配置</li>
            <li>支付宝支付配置</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">Appid</label>
                        <div class="layui-input-inline">
                            <input type="tel" name="appid" value="{$find.appid}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">Appsecret</label>
                        <div class="layui-input-inline">
                            <input type="text" name="appsecret" value="{$find.appsecret}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">Mchid</label>
                        <div class="layui-input-inline">
                            <input type="text" name="mchid" value="{$find.mchid}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-upload" style="margin-left: 80px">
                    <button type="button" class="layui-btn" id="test2">微信支付证书</button>
                    <div class="layui-upload-list">
                        <img class="layui-upload-img" id="demo2" width="100px" height="100px" src="{$find.img}">
                        <p id="demoText2"></p>
                        <input type="hidden" name="img" id="image" value="{$find.img}">
                    </div>
                </div>
                <div class="layui-upload"  style="margin-left: 80px">
                    <button type="button" class="layui-btn" id="test1">微信支付证书密钥</button>
                    <div class="layui-upload-list">
                        <img class="layui-upload-img" id="demo1" width="100px" height="100px" src="{$find.private_key}">
                        <p id="demoText"></p>
                        <input type="hidden" name="private_key"  id="img" value="{$find.private_key}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">Key</label>
                        <div class="layui-input-inline">
                            <input type="text" name="key" value="{$find.key}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">配置目录</label>
                    <div class="layui-input-block">
                        <textarea placeholder="请输入内容" name="catalog" value="{$find.catalog}" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="id" value="{$find.id}">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">蚂蚁金服appid</label>
                        <div class="layui-input-inline">
                            <input type="text" name="financial" value="{$find.financial}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">蚂蚁金服key</label>
                        <div class="layui-input-inline">
                            <input type="text" name="financial_key" value="{$find.financial_key}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">微信分享标题</label>
                        <div class="layui-input-inline">
                            <input type="text" name="public_key" value="{$find.public_key}" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <input type="hidden" name="id" value="{$find.id}">
                        <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<script>
    layui.use(['upload', 'element', 'layer'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,element = layui.element
            ,layer = layui.layer;

        //常规使用 - 普通图片上传
        var uploadInst = upload.render({
            elem: '#test1'
            ,url: '{:url("set/upload")}' //改成您自己的上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo1').attr('src', result); //图片链接（base64）
                });

                element.progress('demo', '0%'); //进度条复位
                layer.msg('上传中', {icon: 16, time: 0});
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }if (res.code == 0) {
                    $("#image").val(res.data);
                    return layer.msg('上传成功');
                }
                //上传成功的一些操作
                //……
                $('#demoText').html(''); //置空上传失败的状态
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
            //进度条
            ,progress: function(n, elem, e){
                element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
                if(n == 100){
                    layer.msg('上传完毕', {icon: 1});
                }
            }
        });
    });
</script>
<script>
    layui.use(['upload', 'element', 'layer'], function(){
        var $ = layui.jquery
            ,upload = layui.upload
            ,element = layui.element
            ,layer = layui.layer;

        //常规使用 - 普通图片上传
        var uploadInst = upload.render({
            elem: '#test2'
            ,url: '{:url("set/upload")}' //改成您自己的上传接口
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function(index, file, result){
                    $('#demo2').attr('src', result); //图片链接（base64）
                });

                element.progress('demo', '0%'); //进度条复位
                layer.msg('上传中', {icon: 16, time: 0});
            }
            ,done: function(res){
                //如果上传失败
                if(res.code > 0){
                    return layer.msg('上传失败');
                }if (res.code == 0) {
                    $("#img").val(res.data);
                    return layer.msg('上传成功');
                }
                //上传成功的一些操作
                //……
                $('#demoText').html(''); //置空上传失败的状态
            }
            ,error: function(){
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
            //进度条
            ,progress: function(n, elem, e){
                element.progress('demo', n + '%'); //可配合 layui 进度条元素使用
                if(n == 100){
                    layer.msg('上传完毕', {icon: 1});
                }
            }

        });
    });
</script>
</body>
{/block}